1. Field of the Invention
The invention relates to a decoding apparatus for decoding code data generated by an encoding process. More specifically, the invention relates to a decoding apparatus for dequantize code data generated by an encoding process including quantizing data, to decode the code data.
2. Description of the Related Art
Since images, audios or the like have enormous amount of data, it is common to reduce an amount of the data by compressing it and then storing or transmitting the compressed data. For example, an amount of multi-value image data generated when color documents or photographs are transformed into an electronic form by a scanner or when scenery is photographed by a digital camera can be significantly reduced by compressing the data using a lossy coding process such as JPEG, JPEG2000 or the like.
However, the lossy coding process causes coding distortion; this is a problem. In particular, the JPEG process has a problem in that block distortion occurs at DCT block boundaries of decoded images (coding distortion).
In this connection, a generation mechanism for the coding distortion of the lossy coding process will be first described.
FIGS. 1A and 1B are block diagrams schematically illustrating a transform coding method such as JPEG and JPEG2000, where FIG. 1A shows an outline of an encoding process and FIG. 1B shows an outline of a decoding process.
FIGS. 2A to 2C are diagrams illustrating a quantization process in the transform coding method. A transform coefficient T(c, i, j) and a quantization index Q(c, i, j) shown in FIGS. 1A and 1B are functions of variables c, i and j. The variable c is an index indicating a kind of transform coefficient. For example, in the case of the DCT transform using 8×8 blocks, the variable c is a value (an integer in a range of 1 to 64) indicating one of 64 (8×8) transform coefficients. In a case of the wavelet transform, the variable c is a value indicating one of components such as 1HH, 1LH, 1HL, 2HH, 2LH, 2HL, . . . , NLL. In addition, the transform variables i and j are variables indicating positions of the transform coefficients, respectively. For example, in the case of the DCT transform, a c-th transform coefficient in a block located at an i-th row from the top and a j-th column from the left is indicated as T (c, i, j). In the case of the wavelet transform, data of a c-th transform coefficient located at an i-th row from the top and a j-th column from the left is indicated as T (c, i, j).
As shown in FIG. 1A, in an encoding process of the transform coding method, an input image G is subject to a transform process such as the discrete cosine transform (DCT) or the wavelet transform to generate a transform coefficient T of the input image G. The transform coefficient T is then quantized into a quantization index Q. The quantization index Q is subject to an entropy coding process (lossless coding process) to be a compression code F.
Here, the quantization index refers to information used to distinguish quantization values. In addition, the quantization value refers to a value to which a group of numerical values within a specific range (quantization interval) are degenerated. For example, as shown in FIGS. 2A to 2C, the quantization values are discrete values (−2×D(c) to 2×D(c) in this example) representing quantization intervals (A-2˜A2), respectively.
Code data (the compression code F) generated in this way are entropy-decoded into a quantization index Q, as shown in FIG. 1B. This quantization index Q is equivalent to the quantization index Q in the encoding process.
Then, the quantization index Q is dequantized into a transform coefficient R (i.e., a dequantization value). Thereafter, the transform coefficient R is inversely transformed to generate a decoded image H.
Here, the dequantization value refers to a value, which is generated based on the quantization index or the quantization value and is used for decoding of data. For example, the dequantization value is a transform coefficient of the JPEG or JPEG2000 (transform coefficient being associated with a quantization index).
In the above-described process, coding distortion occurs during the quantization. In general, precision of the transform coefficient T of an original image is higher than that of the quantization index Q. Accordingly, the transform coefficient R reproduced by using the quantization index Q may be different from the original transform coefficient T. This is the cause of the coding distortion.
Next, the quantization and the dequantization will be described in detail with reference to FIGS. 2A to 2C.
The quantization is performed using a quantization step width D(c) prepared for each transform coefficient c. The quantization step width D(c) is a function of the kind of transform coefficient c. For example, in the case of JPEG, the quantization index Q is calculated according to the following equation in the quantization.Q(c,i,j)=round(T(c,i,j)/D(c))
Where “round( )” is a function outputting an integer closest to an input value.
In addition, the dequantization value R is calculated according to the following equation in the dequantization.R(c,i,j)=Q(c,i,j)×D(c)
In the case of JPEG2000, the quantization index Q and the dequantization value R are calculated according to the following equations.Q(c,i,j)=sign(T(c,i,j))×floor(|T(c,i,j)|/D(c))R(c,i,j)=(Q(c,i,j)+r)×D(c), if Q(c,i,j)>0R(c,i,j)=(Q(c,i,j)−r)×D(c), if Q(c,i,j)<0R(c,i,j)=0, if Q(c,i,j)=0
Where, “sign( )” is a function outputting positive sign or negative sign, “floor ( )” is a function nulling decimal places, and “||” is a symbol representing an absolute value.
In addition, “r” is a numerical value in a range of 0 to 1, typically r=0.5. In the JPEG2000 scheme, there may be a case where lower bits are not encoded. Here, a case where all bits including the least significant bit are encoded will be described by way of examples. Alternatively, in JPEG2000 scheme, it is possible to obtain a number of bits, which are not encoded in the encoding, from a code stream in the decoding. Accordingly, by shifting the quantization step width D to the left by the number of bits and setting the shifted quantization step width as a new quantization width, the JPEG2000 scheme may have the same operation as the JPEG scheme.
As shown in FIG. 2A, in the encoding process of the JPEG, transform coefficients T (before the quantization) generated by the transform process performed for the input image G are distributed on an X axis, which is a numerical straight line.
If a transform coefficient T exists in a quantization interval A0, the quantization index Q becomes 0 by the quantization process. Similarly, if a transform coefficient T exists in a quantization interval Aq, the quantization index Q becomes q.
Then, when the dequantization is performed for the quantization index Q, in a case in which the quantization index Q is 0, the dequantization value R of 0 is generated by the dequantization process. In a case in which the quantization index Q is 1, the dequantization value R of D(c) is generated.
Similarly, in the JPEG2000 scheme, as shown in FIG. 2B, if a transform coefficient T exists in a quantization interval Aq, the quantization index Q becomes q. Then, when the dequantization is performed for the quantization index Q, dequantization values corresponding to quantization indexes Q in a one-to-one manner are generated.
Here, for the sake of simplicity, only the quantization interval Aq in which the quantization index Q becomes q will be considered.
It is assumed that the transform coefficient T exists in the quantization interval Aq.
As shown in FIG. 2C, the quantization interval Aq has a range of d1 to d2. In this case, the transform coefficient T is included in the range of d1 to d2. In addition, it is assumed that a dequantization value of the transform coefficient T is R.
Under this condition, a transform coefficient for generating a decoded image is the dequantization value R. However, the transform coefficient T of an original image has any value within the range of d1 to d2 and is not always equivalent to the dequantization value R. At this time, a difference between the original transform coefficient T and the dequantization value R occurs. This difference is the cause of the coding distortion.
As described previously, the lossy coding process realizes a lossy data compression by degenerating a plurality of data values (original data values existing in each quantization interval) into one quantization value (a quantization value corresponding to each quantization interval), but at the same time, the coding distortion occurs due to the quantization.
In order to reduce this coding distortion, a parameter for reducing compression efficiency in the encoding process may be selected.
However, this causes a problem that encoding efficiency is reduced and the amount of data is increased.
Further, when previously encoded data is intended to be high-quality images, it is impossible to employ such a process in which the compression efficiency is reduced.
For this reason, various techniques have been suggested for overcoming the image distortion problem in the decoding process.
In a broad classification, there are two types of method, that is, a filtering method and a noise method. In the filtering method, a decoded image is subject to a low pass filtering process so as to make coding distortion faint and be conspicuous. In the noise method, noises are added to the decoded image or the transformation coefficient so as to make coding distortion faint and be conspicuous.
First, the method using the low pass filtering process (the filtering method) will be described.
For example, it is known to provide a method applying a low pass filter to only a boundary between DCT blocks in order to remove block distortion.
This method makes the coding distortion faint using the low pass filter so that it is difficult for this distortion to be discriminated.
However, this method has a problem in that edge components of an original image become faint as well.
In addition, it is known to provide a method, which prepares a plurality of low pass filters, determines as to whether or not edges are present in an image, and selectively applies a filter not to cause the edges to be faint, based on a determination result.
Next, the method of adding noises (the noise method) will be described.
For example, it is known to provide a method, which adds noises to DCT coefficients so as to make the coding distortion faint, when it is determined that distortion is noticeable in a region.
In this method, the coding distortion is considered to be noticeable when the region is determined to be a flat image region.
When a decoded image is generated from an encoded image (i.e., a decoding process is performed), it is a goal to approach the decoded image as close as possible to an original image before the original image is subject to an encoding process.
From this point of view, the methods according to prior art do not provide an optimal solution since faintness of the image by the low pass filter or addition of the noises does not approach the decoded image to the original image.
More specifically, these methods may have some side effects as follows.
(1) In the filtering method, signals in a high-frequency band of the decoded image are suppressed. Accordingly, when textures of high frequency components are present in the original image, it is impossible to reproduce these textures.
(2) In the filtering method, there may be a possibility of dullness of the edge due to a possibility of incorrect edge determination.
(3) In the noise method, there may be a possibility of textures occurring, which are not present in the original image, due to the addition of noises.